package eliauk.fun.flowabledemo.vo;


import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Page<T> {
    private List<T> list = new ArrayList<>();

    @ApiModelProperty(value = "记录数")
    private Long totalElements;

    @ApiModelProperty(value = "页数数")
    private Long totalPage;


    public static <T> Page<T> of(List<T> list, Long totalElements, Long totalPage) {
        Page<T> pageResult = new Page<>();
        pageResult.setList(list);
        pageResult.setTotalElements(totalElements);
        pageResult.setTotalPage(totalPage);
        return pageResult;
    }

}